package cn.jilian.meta.service;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import cn.jilian.common.dto.FilterPageSortQuery;
import cn.jilian.common.dto.PageResult;
import cn.jilian.entity.MField;
import cn.jilian.entity.Meta;
import cn.jilian.meta.service.domain.SimpleList;


public interface MetaService {
	
	Map<String,Object> getAttrs(Long id,int rankId);
	
	List<MField> getFields(long id,int rankId);
	
	Collection<Long> getTraitModelIds(Long id);
	
	void registToMainModel(Long metaId,Long mainModelId);

	List<Meta> querySubMetas(Long id);
	
	Collection<Long> getSubMetas(Long id);
	
	Meta getMetaById(long id);
	
	Map<String,Object> getFullMetaById(Long id);
	
	Meta queryMetaByName(String name);
	
	SimpleList getEnumListByName(String name);
	
	SimpleList getEnumListById(Long id);
	
	int updateMeta(Meta meta);
	
	Meta addMeta(Meta meta);
	
	int saveTraits(long id,Map<String,Object> data,long metaId);
	
	int addRecord(Long metaId,Map<String,Object> data);
	
	int addRecord(Meta meta,Map<String,Object> data);
	
	int updateRecord(Long metaId,Map<String,Object> data);
	
	int updateRecord(Meta meta,Map<String,Object> data);
	
	int deleteMeta(long metaId);
	
	int deleteRecord(Long id,Long metaId);
	
	int moveRecord(Long metaId,Long id,Long fid,Long seq);
	
	int moveRecord(Long metaId,Long id,int step);
	
	Map<String,Object> getRecord(Long metaId,Long id);
	
	Map<String,Object> getRecord(Meta meta,Long id);
	
	List<Map<String,Object>> getChildren(Meta meta,Long id);
	
	List<Map<String,Object>> getChildren(Long metaId,Long id);
	
	List<Map<String,Object>> getAllChildren(Long metaId,Long id);
	
	PageResult<Map<String,Object>> pageQuery(Long metaId,FilterPageSortQuery query);
	
	PageResult<Map<String,Object>> pageQuery(Meta meta,FilterPageSortQuery query);
	
	Map<String,Object> query(Meta meta,Map<String,Object> params);
	
	
	
}
